package com.ssy.lingxi.member.merchant.repository;

import com.ssy.lingxi.member.merchant.entity.MemberConfigDO;
import com.ssy.lingxi.member.merchant.entity.MemberDepositoryDetailDO;
import com.ssy.lingxi.member.merchant.entity.MemberRelationDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 会员入库资料Jpa仓库
 * @author 万宁
 * @version 2.0.0
 * @date 2021-05-20
 */
@Repository
public interface MemberDepositoryDetailRepository extends JpaRepository<MemberDepositoryDetailDO, Long>, JpaSpecificationExecutor<MemberDepositoryDetailDO> {
    List<MemberDepositoryDetailDO> findByRelation(MemberRelationDO relationDO);

    List<MemberDepositoryDetailDO> findByRelationAndVersion(MemberRelationDO relationDO, Integer version);

    @Transactional
    void deleteByMemberConfig(MemberConfigDO configDO);

    @Transactional
    void deleteByRelation(MemberRelationDO relationDO);

    @Transactional
    void deleteByRelationAndVersion(MemberRelationDO relationDO, Integer version);
}
